// 布局
import '@/assets/less/global.less'
// vue 框架
import Vue from 'vue'
import App from '@/App'
import store from '@/vuex/store'
import router from '@/router/index'
import _ from 'lodash'
Vue.config.productionTip = false

// mint-ui  按需引入
import { TabContainer, TabContainerItem, Navbar, Tabbar, TabItem, Toast, InfiniteScroll} from 'mint-ui'
Vue.component(Navbar.name, Navbar)
Vue.component(Tabbar.name, Tabbar)
Vue.component(TabItem.name, TabItem)
Vue.component(TabContainer.name, TabContainer)
Vue.component(TabContainerItem.name, TabContainerItem)
Vue.component(Toast.name, Toast)
Vue.use(InfiniteScroll)

// echarts
import 'echarts/lib/chart/bar'
import 'echarts/lib/chart/pie'
import 'echarts/lib/chart/gauge'
import 'echarts/lib/chart/line'
import 'echarts/lib/component/tooltip'
import 'echarts/lib/component/legend'
import ECharts from 'vue-echarts/components/ECharts'
import theme from '@/mixins/theme.json'
import mixCharts from '@/mixins/mixCharts'
ECharts.registerTheme('roma', theme)
Vue.component('chart', ECharts)
Vue.mixin(mixCharts)

// dy components
import components from '@/components/index'
Vue.use(components);

//手机上
// document.addEventListener('deviceready', function(){
//     document.addEventListener("backbutton", function(){
//         // 收藏页跳转过来
//         if(Object.keys(app.$store.getters.detailCondit).length > 0) {
//             app.$router.go(-1)
//         }else if(location.href.match('/loans/cockpit') || location.href.match('/all/index') ||location.href.match('/collect/index')) {
//             // 驾驶舱 -- 总览 -- 收藏
//             cordova.exec(null, null, "commonPlugin", "onback", []);
//             // 其他地址
//         } else if(location.href.match('/loans')) {
//             app.$router.replace("/loans/cockpit");
//         }
//     }, false)
//     window.app = new Vue({
//         el: '#app',
//         store,
//         router,
//         template: '<App/>',
//         components: { App }
//     })
// }, false);

// if(typeof cordova === "undefined"){
    window.app = new Vue({
        el: '#app',
        store,
        router,
        template: '<App/>',
        components: { App }
    })
// }

